﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;

/// <summary>
///Student 的摘要说明
/// </summary>
public class Student : Component
{
    private string name;  //姓名
    private int sex;    //性别

    private String schoolID;    //学校ID

    public String SchoolID
    {
        get { return schoolID; }
        set { schoolID = value; }
    }
    private string bitrhday;         //出生日期

    private string IDCard;   //身份证号
    private string telephonenumber = "";
    private string studentID;//学生证号

    public string Name
    {
        get { return name; }
        set { name = value; }
    }



    public int Sex
    {
        get { return sex; }
        set { sex = value; }
    }

    public string Bitrhday
    {
        get { return bitrhday; }
        set { bitrhday = value; }
    }

   


    public string IDCard1
    {
        get { return IDCard; }
        set { IDCard = value; }
    }


    public string StudentID
    {
        get { return studentID; }
        set { studentID = value; }
    }



    public string Telephonenumber
    {
        get { return telephonenumber; }
        set { telephonenumber = value; }
    }


    public override  string insert(SqlConnection sqlcon)
    {
        try
        {
            SqlDataAdapter sqladt = new SqlDataAdapter();
            string[] values = { SqlFormat.ap(IDCard), SqlFormat.ap(name), "" + sex, SqlFormat.ap(bitrhday), SqlFormat.ap(studentID), SqlFormat.ap(telephonenumber), "" + schoolID };
            //string cmdinStudent = exeProcedureNotap("inputStudent", values);
            string cmdinStudent = SqlFormat.insertTableNotAp("Student", values);
            sqladt.InsertCommand = new SqlCommand(cmdinStudent, sqlcon);
            if (sqladt.InsertCommand.ExecuteNonQuery() == 0)
                return null;
            return "ok";
        }
        catch (System.Exception ex)
        {
            return ex.Source;
        }
         
    }

    
  

	public Student()
	{
		//
		//TODO: 在此处添加构造函数逻辑
		//
        name = "";
        sex = 0;
        bitrhday = "";
        IDCard = "";
        studentID = "";
        schoolID = "";
	}
}